import layoutHeaderAside from '@/layout/header-aside'

// 由于懒加载页面太多的话会造成webpack热更新太慢，所以开发环境不使用懒加载，只有生产环境使用懒加载
const _import = require('@/libs/util.import.' + process.env.NODE_ENV)

const meta = { auth: true }

export default {
    path: '/product',
    name: 'product',
    meta,
    redirect: { name: 'product' },
    component: layoutHeaderAside,
    children: (pre => [
      {
        path: 'brand/index',
        name: `${pre}brand/index`,
        component: _import('product/brand/index'),
        meta: {
          ...meta,
          title: '品牌列表'
        }
      },
      {
        path: 'category/index',
        name: `${pre}category/index`,
        component: _import('product/category/index'),
        meta: {
          ...meta,
          title: '分类列表'
        }
      },
      {
        path: 'categoryFront/index',
        name: `${pre}categoryFront/index`,
        component: _import('product/categoryFront/index'),
        meta: {
          ...meta,
          title: '展示类目'
        }
      },
      {
          path: 'productInfoSku/index',
          name: `${pre}productInfoSku-index`,
          component: _import('product/productInfoSku/index'),
          meta: {
              ...meta,
              title: '商品列表'
          }
      },
	    {
	      path: 'productInfoSku/add',
	      name: `${pre}productInfoSku-add`,
	      component: _import('product/productInfoSku/add'),
	      meta: {
	          ...meta,
	          title: '添加商品',
			  cache: true,
	      }
	    },
	    {
	      path: 'productInfoSku/update',
	      name: `${pre}productInfoSku-update`,
	      component: _import('product/productInfoSku/update'),
	      meta: {
	          ...meta,
	          title: '编辑商品',
			  cache: true,
	      }
	    },
	    {
	      path: 'productInfoSku/details',
	      name: `${pre}productInfoSku-details`,
	      component: _import('product/productInfoSku/details'),
	      meta: {
	          ...meta,
	          title: '商品详情',
			  //cache: true,
	      }
	    },
	    {
	      path: 'productInfoSku/skuList',
	      name: `${pre}productInfoSku-skuList`,
	      component: _import('product/productInfoSku/skuList'),
	      meta: {
	          ...meta,
	          title: 'SKU列表'
	      }
	    },
	    {
	      path: 'productInfoSku/saleList',
	      name: `${pre}productInfoSku-saleList`,
	      component: _import('product/productInfoSku/saleList'),
	      meta: {
	          ...meta,
	          title: '销售列表'
	      }
	    },
		{
		  path: 'exchangeProduct/list',
		  name: `${pre}exchangeProductList`,
		  component: _import('product/exchange/exchangeProductList'),
		  meta: {
		      ...meta,
		      title: '兑换商品列表'
		  }
		}
    ])('product-')
}
